<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header>
      内容管理详情
    </el-header>
    <el-main>
      <el-form label-width="200px" :inline="true" style="padding:5% 5% 0 5%">
        <el-form-item label="主键id：">
          <span>{{formData.id}}</span>
        </el-form-item>
        <el-form-item label="栏目id：">
          <span>{{formData.class_id}}</span>
        </el-form-item>
        <el-form-item label="标题：">
          <span>{{formData.title}}</span>
        </el-form-item>
        <el-form-item label="副标题：">
          <span>{{formData.short_title}}</span>
        </el-form-item>
        <el-form-item label="正文：">
          <span v-html='formData.content'></span>
        </el-form-item>
        <el-form-item label="正文1：">
          <span v-html='formData.content1'></span>
        </el-form-item>
        <el-form-item label="正文2：">
          <span v-html='formData.content2'></span>
        </el-form-item>
        <el-form-item label="内容模型：">
          <span>{{formData.model_type}}</span>
        </el-form-item>
        <el-form-item label="状态：">
          <span>{{formData.status}}</span>
        </el-form-item>
        <el-form-item label="排序：">
          <span>{{formData.sort}}</span>
        </el-form-item>
        <el-form-item label="置顶方式：">
          <span>{{formData.top_type}}</span>
        </el-form-item>
        <el-form-item label="保密级别：">
          <span>{{formData.secret_level}}</span>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import { Loading } from "element-ui";
import {
  articleInfo
} from '@/api/project/article/project_article_article'
export default {
  name: "a_articlea_article_info",
  data() {
    return {
      infoLoading: false,
      formData:{
        id: 0, 
        class_id: 0, 
        title: '', 
        short_title: '', 
        content: '', 
        content1: '', 
        content2: '', 
        model_type: 0, 
        status: 0, 
        sort: 0, 
        top_type: 0, 
        secret_level: 0, 
      }
    };
  },
  activated() {
    var result = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"));
    if(result != null || result.length > 0){
      this.onInfo(result[1]);
    }
  },
  methods: {
    onInfo(id){
      this.infoLoading=true;
      articleInfo({id:id}).then(r=>{
        this.formData.id = r.dataSingle.id, 
        this.formData.class_id = r.dataSingle.class_id, 
        this.formData.title = r.dataSingle.title, 
        this.formData.short_title = r.dataSingle.short_title, 
        this.formData.content = r.dataSingle.content, 
        this.formData.content1 = r.dataSingle.content1, 
        this.formData.content2 = r.dataSingle.content2, 
        this.formData.model_type = r.dataSingle.model_type, 
        this.formData.status = r.dataSingle.status, 
        this.formData.sort = r.dataSingle.sort, 
        this.formData.top_type = r.dataSingle.top_type, 
        this.formData.secret_level = r.dataSingle.secret_level, 
        this.infoLoading=false;
      }).catch(()=>{
        this.infoLoading=false;
      });
    }
  }
}
</script>
